package org.jeecg.modules.demo.pubuyorderToRk.service.impl;

import org.jeecg.modules.demo.pubuyorderToRk.entity.PuBuyOrderToRk;
import org.jeecg.modules.demo.pubuyorderToRk.entity.RkOrder;
import org.jeecg.modules.demo.pubuyorderToRk.mapper.RkOrderMapper;
import org.jeecg.modules.demo.pubuyorderToRk.mapper.PuBuyOrderToRkMapper;
import org.jeecg.modules.demo.pubuyorderToRk.service.IPuBuyOrderToRkService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 采购订单
 * @Author: jeecg-boot
 * @Date:   2022-05-20
 * @Version: V1.0
 */
@Service
public class PuBuyOrderToRkServiceImpl extends ServiceImpl<PuBuyOrderToRkMapper, PuBuyOrderToRk> implements IPuBuyOrderToRkService {

	@Autowired
	private PuBuyOrderToRkMapper puBuyOrderToRkMapper;
	@Autowired
	private RkOrderMapper rkOrderMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		rkOrderMapper.deleteByMainId(id);
		puBuyOrderToRkMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			rkOrderMapper.deleteByMainId(id.toString());
			puBuyOrderToRkMapper.deleteById(id);
		}
	}
	
}
